from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from page.base_page_helin import BasePage

class AddZjPage(BasePage):
    # 进入添加组价页面定位器
    ybp_locator=(By.LINK_TEXT,"仪表盘")
    tjzj_locator=(By.ID,"add")

    # 添加组件定位器
    zjm_locator=(By.ID,'title')
    xzzj_locator=(By.ID,'widget')
    qd_locator=(By.CSS_SELECTOR,'input[value=保存]')

    def click_ybp(self):
        # 进入组件页面
        self.driver.find_element(*self.ybp_locator).click()

    def click_tjzj(self):
        self.driver.find_element(*self.tjzj_locator).click()

        # 添加组件
    def add_zjm(self,zjm):
        self.driver.find_element(*self.zjm_locator).send_keys(zjm)

    def add_xzzj(self,xzzj):
        self.xzzj_element=self.driver.find_element(*self.xzzj_locator)
        select=Select(self.xzzj_element)
        select.select_by_visible_text(xzzj)

    def add_qdan(self):
        self.driver.find_element(*self.qd_locator).click()
